﻿using System;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;

namespace Win104.ZZH
{
    public sealed class TcpSocketClientConfiguration
    {

        public TcpSocketClientConfiguration()
        {
            ReceiveBufferSize = 20480;                   // 每次的接收缓冲区
            SendBufferSize = 10240;                      // 发送缓冲区
            ReceiveTimeout = TimeSpan.Zero;             // 接收超时，用于同步方法
            SendTimeout = TimeSpan.Zero;                // 发送超时，用于同步方法
            NoDelay = true;                             // 禁用延时
            LingerState = new LingerOption(false, 0);   // Close方法调用后不逗留
            KeepAlive = false;                          
            KeepAliveInterval = TimeSpan.FromSeconds(5);
            ReuseAddress = false;                       

            ConnectTimeout = TimeSpan.FromSeconds(3);   //链接超时
        }

        public int ReceiveBufferSize { get; set; }
        public int SendBufferSize { get; set; }
        public TimeSpan ReceiveTimeout { get; set; }
        public TimeSpan SendTimeout { get; set; }
        public bool NoDelay { get; set; }
        public LingerOption LingerState { get; set; }
        public bool KeepAlive { get; set; }
        public TimeSpan KeepAliveInterval { get; set; }
        public bool ReuseAddress { get; set; }

        public TimeSpan ConnectTimeout { get; set; }
    }
}
